//---------------------------------------------------------------------------

#ifndef CBarH
#define CBarH
//---------------------------------------------------------------------------
#include <SysUtils.hpp>
#include <Controls.hpp>
#include <Classes.hpp>
#include <Forms.hpp>
#include <comctrls.hpp>
#include "outils.h"
//---------------------------------------------------------------------------
#include "math.h" // ceil et max
//---------------------------------------------------------------------------
enum eTYPEBAR { BAR_Backup, BAR_Wait  };
//---------------------------------------------------------------------------
class PACKAGE_OUTILS CShowProgress : public TComponent
{
private:
    eTYPEBAR        FTypeBar;
    AnsiString      FTitre;
    AnsiString      FMessage;
    AnsiString      FMessageInfo;
    TCommonAVI      FCommonAVI;
    bool            FActive;
    // Composants contenus dans la Form
    TForm          *m_Form;
    TLabel         *m_Message;
    TLabel         *m_MessageInfo;
    TAnimate       *m_Animate;
    // Sauvegarde du curseur en cours
    TCursor         m_Cursor;

private:
    void    __fastcall _Init( void );
    // Creation dynamique des composants
    bool    __fastcall _CreateForm(void);
    bool    __fastcall _CreateFormAnimate(void); // Fenetre avec animation
    bool    __fastcall _CreateFormWait(void);    // Fenetre avec barre de défilement

    // Declencheurs
    void    __fastcall _SetTitre        ( AnsiString Valeur );
    void    __fastcall _SetMessage      ( AnsiString Valeur );
    void    __fastcall _SetMessageInfo  ( AnsiString Valeur );
    void    __fastcall _SetCommonAVI    ( TCommonAVI Valeur );
    void    __fastcall _SetActive       ( bool Valeur       );

#pragma option push -w-inl
    inline void             __fastcall _SetTypeBar   ( eTYPEBAR Valeur     ) { FTypeBar = Valeur; };
#pragma option pop

__published:
    __property AnsiString Message     = { read = FMessage,      write = _SetMessage,                            };
    __property AnsiString MessageInfo = { read = FMessageInfo,  write = _SetMessageInfo                         };
    __property TCommonAVI CommonAVI   = { read = FCommonAVI,    write = _SetCommonAVI,  default = aviNone       };
    __property AnsiString Titre       = { read = FTitre,        write = _SetTitre                               };
    __property eTYPEBAR TypeBar       = { read = FTypeBar,      write = _SetTypeBar,    default = BAR_Backup    };
    __property bool Active            = { read = FActive,       write = _SetActive,     default = false         };

public:
            __fastcall CShowProgress(TComponent* Owner);
    virtual __fastcall ~CShowProgress();

    void    __fastcall Open();    
    void    __fastcall Close();
};
//---------------------------------------------------------------------------
#endif
